package com.shishuo.cms.action;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class IndexAction extends IndexBaseAction
{
	@RequestMapping(value = "/index.htm", method = RequestMethod.GET)
	public String index(HttpServletRequest request) throws Exception
	{
		String doMainUrl = request.getServerName();
        if(doMainUrl != null && !doMainUrl.equals("") &&doMainUrl.indexOf("localhost") == -1 && doMainUrl.indexOf("127.0.0.1") == -1) {
        	String [] arrStrings=doMainUrl.split("\\.");
        	String domainName=arrStrings[0];
        	if (domainName.contains("goods_item_")) {
        		return "forward:/goods_item/"+domainName.replace("goods_item_", "")+".htm";
			}
        }
		request.setAttribute("title", this.getMsgByMsgKey("main.title"));
		return this.getTemplatePath()+"index";
	}
}
